#pragma once

#include <MCF/Code/StdMCF.hpp>
#include <MCF/Code/TabControlClass.hpp>

class TabRAMROMClass sealed : public MCF::TabDialogBaseClass {
private:
	static const std::size_t _SNAPSHOT_SIZE = 512;
private:
	typedef enum {
		DU_BYTES,
		DU_WORDS,
		DU_ASCII
	} _DISPLAY_UNIT;
private:
	static bool _ThreadEventGUIInitializeProc(std::intptr_t nContext, std::intptr_t nArg1, std::intptr_t nArg2, std::intptr_t nArg3);
private:
	bool _m_bIsSnapshotAvailable;
	DWORD _m_dwSnapshotBeginAddr;
	WORD _m_arwSnapshotContents[_SNAPSHOT_SIZE];
	_DISPLAY_UNIT _m_eDisplayUnit;
public:
	TabRAMROMClass(HWND hParent);
	virtual ~TabRAMROMClass();
protected:
	virtual void _PostSubclass() override;
	virtual void _PreUnsubclass() override;

	virtual bool _OnInitDialog(HWND hDefControl, LPARAM lInitParam) override;
	virtual bool _OnCommand(WORD wNotifyCode, int nControlID, HWND hSender) override;
private:
	void _RefreshSnapshotText();
	void _SetDisplayUnit(_DISPLAY_UNIT eDisplayUnit);

	void _ClearSnapshot();
	void _DoSnapshot(DWORD dwAddr);

	void _CheckAddressBoxText();
	void _CommandSnapshot();
};
